//index.js
//获取应用实例
const app = getApp()
import {
    getIndexImage
} from '../../utils/tuchong_api.js'
Page({
    data: {
        launchEnable: false,
        launchImgUrl: "https://xsbimg.oss-cn-beijing.aliyuncs.com/test/coverage2.GIF",
        isGank: false,

        userInfo: {},
        hasUserInfo: false,
        canIUse: wx.canIUse('button.open-type.getUserInfo'),
        angle: 100,
        picList: [],
        countDown: 4,
        jumpTextShow: true
    },
    onReady: function () {
    },
    onLoad: function () {
        let self = this;
        console.log('launchImgUrl: ' + self.data.launchImgUrl)
        setTimeout(function(){self.goUser();},self.data.countDown*1000)
    },
    getUserInfo: function (e) {
        app.globalData.userInfo = e.detail.userInfo
        this.setData({
            userInfo: e.detail.userInfo,
            hasUserInfo: true
        })
    },
    getImage() {
        let context = this
        let callBackSuccess = function (res) {
            if (res.data.feedList.length) {
                //console.log(res)
                context.setData({
                    picList: [...context.data.picList, ...res.data.feedList]
                })
                wx.setStorage({
                    key: "launch_pic_list",
                    data: context.data.picList
                })
            }
        }
        getIndexImage(callBackSuccess)
    },
    goUser() {
        console.log(1)
        wx.switchTab({
            url: '../index/index'
        })
    },
    goBack() {
        wx.navigateBack({
            delta: 1
        })
    }
})